package com.example.algorithms.recursion;

/**
 * @Author Zhang Jie
 * @Date 10/19/20
 * @Version 1.0
 * 阶乘n!
 * n*(n-1)*(n-2)*...*2*1
 * 0!=1
 * f(n)=n*f(n-1)
 */

public class Factorial {

    public static int f(int n){
        if(n==0||n==1){
            System.out.println(1);
            return 1;
        }
        System.out.printf("%d*",n);
        return n*f(n-1);
    }
}
